import java.util.ArrayList;
import java.util.List;

public class BookShelf implements Aggregate {
    private List<Book> list=new  ArrayList<>();
//    private Book[] books;
//    private int last = 0;
//    public BookShelf(int maxsize) {
//        this.books = new Book[maxsize];
//    }
    public Book getBookAt(int index)
    {
        return list.get(index);
        //return books[index];
    }
    public void appendBook(Book book) {
//        this.books[last] = book;
//        last++;
        this.list.add(book);
    }
    public int getLength()
    {
//        return last;
        return list.size();
    }
    public BookIterator iterator() {
        return new BookIteratorImpl(list);
    }
}
